<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<%@ taglib prefix="my" uri="/WEB-INF/tld/my.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${projectName}-编辑</title>
<jsp:include page="/WEB-INF/view/inc/css.jsp"></jsp:include>
</head>
<body class="cld-body">
	<div class="enter-panel ep-sm">
  			<input type="hidden" id="aatlId" value="${appApiTestLog.aatlId}"/>
  		<div class="form-group"><div class="col-sm-12">入参
  			<textarea class="form-control" id="result" rows="3" placeholder="响应结果" style="width:500px;">${appApiTestLog.params}</textarea></div>
  		</div>
  		<div class="form-group">
			<div class="col-sm-12">响应结果
				<textarea class="form-control" id="result" rows="5" placeholder="响应结果" style="width:500px;">${appApiTestLog.result}</textarea>
			</div>
		</div>
  		<div class="form-group">
			<div class="col-sm-12">正确结果
				<textarea class="form-control" id="resultSucc" rows="5" placeholder="正确结果" style="width:500px;">${appApiTestLog.resultSucc}</textarea>
			</div>
		</div>
  		<div class="form-group"><div class="col-sm-12">对比结论：${appApiTestLog.resultComparison}</div></div>
  		<div class="footer-operate">
			<span id="saveMsg" class="label label-danger"></span>
 			<div class="btn-group">
				<button type="button" class="btn btn-default" onclick="parent.dialog.close()">关闭</button>
				<button type="button" id="saveFailBtn" class="btn btn-danger" onclick="info.save('saveFailBtn', 40)">测试不通过</button>
				<button type="button" id="saveBtn" class="btn btn-success" onclick="info.save('saveBtn', 30)">测试通过</button>
			</div>
		</div>
	</div>

	<jsp:include page="/WEB-INF/view/inc/js.jsp"></jsp:include>
	<script type="text/javascript">
	var info = {
			save: function(eventId, status) {
				var saveMsg = $('#saveMsg').empty();
				JUtil.ajax({
					eventId: eventId,
					url: '${webroot}/appApiTest/f-json/saveTest',
					data: {
						aatlId: $('#aatlId').val(),
						status: status
					},
					success : function(json) {
						if (json.code === 0) {
							saveMsg.attr('class', 'label label-success').append('操作成功');
							setTimeout(function() {
								parent.apiAutoTestDtlInfo.loadInfo();
								parent.dialog.close();
							}, 800);
						}
						else if (json.code === -1)
							saveMsg.append(JUtil.msg.ajaxErr);
						else
							saveMsg.append(json.message);
					}
				});
			}
	};
	</script>
</body>
</html>